package com.demo.weather.server.handler;

import java.io.IOException;

import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import lombok.extern.slf4j.Slf4j;

/**
 * @author tangheng
 * @param <I>
 */
@Slf4j
@ChannelHandler.Sharable
public abstract class AbstractServerHandler<I> extends SimpleChannelInboundHandler<I> {

    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
    	if(cause instanceof IOException) {
    		log.info("{}", cause.getMessage());
    		return;
    	}
    	
        log.error("exception -> {}", cause.getMessage(), cause);
    }
}